/*
 * Copyright (c) zhg2yqq.com Corp.
 * All Rights Reserved.
 */
package com.zhg2yqq.wheels.security.exception;

import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import com.zhg2yqq.wheels.common.response.AbstractAdvice;
import com.zhg2yqq.wheels.common.response.RestResponse;

/**
 * @author zhg2yqq, 2023年12月27日
 * @version zhg2yqq v1.0
 */
@Order(Ordered.HIGHEST_PRECEDENCE)
@RestControllerAdvice(annotations = {RestController.class, ResponseBody.class})
@ControllerAdvice(annotations = {Controller.class, ResponseBody.class})
public class SecurityExceptionAdvice extends AbstractAdvice {

    @ExceptionHandler({AccessDeniedException.class})
    public RestResponse<Object> exceptionAccessDeniedException(AccessDeniedException e) {
        throw e;
    }
}
